<?
	$params[sid] = $sid;
	$params[action] = "editTemplate";
	$url = "$baseURL/?".encode_params($params);
	$data = get_interface_settings($id);
	if(is_array($data))
		while(list($k,$v) = each($data)){
			$$k = $v;
		}
	switch($template){
		case "0": $ch[1] = "checked"; break;
		case "1": $ch[2] = "checked"; break;
		case "2": $ch[3] = "checked"; break;
		case "3": $ch[4] = "checked"; break;
		case "4": $ch[5] = "checked"; break;
		case "5": $ch[6] = "checked"; break;
		case "6": $ch[7] = "checked"; break;
		case "7": $ch[8] = "checked"; break;
		case "8": $ch[9] = "checked"; break;
		case "9": $ch[10] = "checked"; break;
		case "10": $ch[11] = "checked"; break;
		case "11": $ch[12] = "checked"; break;
		case "12": $ch[13] = "checked"; break;
		case "13": $ch[14] = "checked"; break;
		case "14": $ch[15] = "checked"; break;


	}

//	if($errorMsg) echo "<b><br><div class=errormsg>$errorMsg</div><br></b><br>";
//	$errorMsg = "";
?>


<table width="450">
  <tr>
    <td colspan=2><font class="text"><b><?=translate('template_manager');?></b><br>
      <br>
      <?=translate('template_manager_desc');?>
      </font></td>
  </tr>
</table>
<br>
<?
	if ($errorMsg) {
	include_once('errorMsg.html');
	}
	if ($okMsg) {
	include_once('okMsg.html');
	}
	else{
	}
?>
<script>
function change_img(el){
	limage=document.getElementById('large_image');

	limage.src='images/r'+el.value+'_big.jpg';
}
</script>
<TABLE border=1 class='bTable' cellspacing='0' width='560'>
  <form action='<?=$url;?>' method='POST'>
	<TR>

      <TH colspan='2'><?=translate('template_manager');?></TH>
	</TR>
	<TR>
		<TD align='center'>
			<table border=0 width='100%'>
				<tr align='center'>
					<td>
						<img width=90 src='images/r0.jpg'>
					</td>
                                        <td>
                                                <img width=90 src='images/r1.jpg'>
                                        </td>
                                        <td>
                                                <img width=90 src='images/r2.jpg'>
                                        </td>
                                        <td>
                                                <img width=90 src='images/r3.jpg'>
                                        </td>
                                </tr>
				<tr align='center'>
					<td>
						<input type='radio' name='template' value='0' <?=$ch[1];?>>
					</td>
                                        <td>
                                                <input type='radio' name='template' value='1' <?=$ch[2];?>>
                                        </td>
                                        <td>
                                                <input type='radio' name='template' value='2' <?=$ch[3];?>>
                                        </td>
                                        <td>
                                                <input type='radio' name='template' value='3' <?=$ch[4];?>>
                                        </td>
                                </tr>
								<tr align='center'>
                                        <td>
                                                <img width=90 src='images/r4.jpg'>
                                        </td>
                                        <td>
                                                <img width=90 src='images/r5.jpg'>
                                        </td>
                                        <td>
                                                <img width=90 src='images/r6.jpg'>
                                        </td>
                                        <td>
                                                <img width=90 src='images/r7.jpg'>
                                        </td>
                                </tr>
                                <tr align='center'>
                                        <td>
                                                <input type='radio' name='template' value='4' <?=$ch[5];?>>
                                        </td>
                                        <td>
                                                <input type='radio' name='template' value='5' <?=$ch[6];?>>
                                        </td>
                                        <td>
                                                <input type='radio' name='template' value='6' <?=$ch[7];?>>
                                        </td>
                                        <td>
                                                <input type='radio' name='template' value='7' <?=$ch[8];?>>
                                        </td>
                                </tr>
                                <tr align='center'>
									<td>
											<img width=90 src='images/r8.jpg'>
									</td>
									<td>
											<img width=90 src='images/r9.jpg'>
									</td>
									<td>
											<img width=90 src='images/r10.jpg'>
									</td>
									<td>
											<img width=90
src='images/r11.jpg'><br>
											<img src='images/langsalt1.jpg' valign='center'>
									</td>
								</tr>
								<tr align='center'>
									<td>
											<input type='radio' name='template' value='8' <?=$ch[9];?>>
									</td>
									<td>
											<input type='radio' name='template' value='9' <?=$ch[10];?>>
									</td>
									<td>
											<input type='radio' name='template' value='10' <?=$ch[11];?>>
									</td>
									<td>
											<input type='radio' name='template' value='11' <?=$ch[12];?>>
									</td>
                                </tr>
                                <tr align='center'>
									<td>
											<img width=90
src='images/r12.jpg'><br>
											<img src='images/langsalt.jpg' valign='center'>
									</td>
									<td>
											<img width=90
src='images/r13.jpg'><br>
											<img src='images/langsalt.jpg' valign='center'>
									</td>
									<td>
											<img width=90
src='images/r14.jpg'><br>
											<img src='images/langsalt.jpg' valign='center'>
									</td>
								</tr>
								<tr align='center'>
									<td>
											<input type='radio' name='template' value='12' <?=$ch[13];?>>
									</td>
									<td>
											<input type='radio' name='template' value='13' <?=$ch[14];?>>
									</td>
									<td>
											<input type='radio' name='template' value='14' <?=$ch[15];?>>
									</td>
                                </tr>
			</table>
		</TD>
	</TR>
	<TR>
		<TD  align='center' colspan='2'>
			<input type='submit' value='<?=translate('submit');?>'>
		</TD>
	</TR>
	<table width="450">
		  <tr>
		    <td colspan=2><font class="text"><br><br>
                       The flags below the template thumbnail represents the languages the template can be translated using the drop-down menu.<br><br>
                        Country flags legend : <br>
                        <br>
                        <img src='images/en.jpg'> - English <br>
                        <img src='images/pt.jpg'> - Portuguese <br>
                        <img src='images/fr.jpg'> - French <br>
                        <img src='images/es.jpg'> - Spanish

      </font></td>
  </tr>
</table>

</form>
</TABLE>

